import type { RouteRecordRaw } from "vue-router"

/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      hidden: true,
    },
  },

  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
    meta: {
      hidden: true,
    },
  },

  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "Home",
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "仪表盘",
          icon: "ele-Odometer",
        },
      },
    ],
  },
  // 文章
  {
    name: "Posts",
    path: "/posts",
    meta: {
      title: "文章",
      icon: "ele-Edit",
    },
    component: () => import("@/layout/index.vue"),
    children: [
      {
        name: "List",
        path: "/list",
        meta: {
          title: "所有文章",
        },
        component: () => import("@/views/Posts/list/index.vue"),
      },
      {
        name: "Write",
        path: "/write",
        meta: {
          title: "写文章",
        },
        component: () => import("@/views/Posts/write/index.vue"),
      },
      {
        name: "Categories",
        path: "/categories",
        meta: {
          title: "分类目录",
        },
        component: () => import("@/views/Posts/categories/index.vue"),
      },
      {
        name: "Tags",
        path: "/tags",
        meta: {
          title: "标签",
        },
        component: () => import("@/views/Posts/Tags/index.vue"),
      },
    ],
  },

  // 页面
  {
    name: "Sheets",
    path: "/sheets",
    meta: {
      title: "页面",
      icon: "ele-Reading",
    },
    component: () => import("@/layout/index.vue"),
    children: [
      {
        name: "AllPage",
        path: "/allPage",
        meta: {
          title: "所有页面",
        },
        component: () => import("@/views/sheets/allPage/index.vue"),
      },
      {
        name: "NewlyBuild",
        path: "/newlyBuild",
        meta: {
          title: "新建页面",
        },
        component: () => import("@/views/sheets/newlyBuild/index.vue"),
      },
    ],
  },
  // 附件
  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "/attachments",
        name: "Attachments",
        component: () => import("@/views/attachments/index.vue"),
        meta: {
          title: "附件",
          icon: "ele-Picture",
        },
      },
    ],
  },
  // 评论
  {
    name: "UserComment",
    path: "/comment",
    meta: {
      title: "评论",
      icon: "ele-ChatLineRound",
    },
    component: () => import("@/views/user/comment/index.vue"),
  },
  // 外观
  {
    name: "Interface",
    path: "/interface/themes",
    meta: {
      title: "外观",
      icon: "ele-Star",
    },
    component: () => import("@/layout/index.vue"),
    children: [
      {
        name: "Themes",
        path: "/themes",
        meta: {
          title: "主题",
        },
        component: () => import("@/views/interface/themes/index.vue"),
      },
      {
        name: "Setting",
        path: "/setting",
        meta: {
          title: "主题设置",
        },
        component: () => import("@/views/interface/setting/index.vue"),
      },
      {
        name: "Edit",
        path: "/edit",
        meta: {
          title: "主题编辑",
        },
        component: () => import("@/views/interface/edit/index.vue"),
      },
      {
        name: "Menus",
        path: "/menus",
        meta: {
          title: "菜单设置",
        },
        redirect: "/themes",
        component: () => import("@/views/interface/menus/index.vue"),
      },
    ],
  },
  // 用户
  {
    name: "User",
    path: "/user",
    meta: {
      title: "用户",
      icon: "ele-User",
    },
    component: () => import("@/layout/index.vue"),
    children: [
      /* {
        name: "UserComment",
        path: "/comment",
        meta: {
          title: "评论",
        },
        component: () => import("@/views/user/comment/index.vue"),
      }, */
      {
        name: "Profile",
        path: "/profile",
        meta: {
          title: "个人资料",
        },
        component: () => import("@/views/user/profile/index.vue"),
      },
    ],
  },

  // 系统
  {
    name: "System",
    path: "/system",
    meta: {
      title: "系统",
      icon: "ele-Setting",
    },
    component: () => import("@/layout/index.vue"),
    children: [
      {
        name: "Options",
        path: "/options",
        meta: {
          title: "博客设置",
        },
        component: () => import("@/views/system/options/index.vue"),
      },
      {
        name: "Tools",
        path: "/tools",
        meta: {
          title: "小工具",
        },
        component: () => import("@/views/system/tools/index.vue"),
      },
      {
        name: "About",
        path: "/about",
        meta: {
          title: "关于",
        },
        component: () => import("@/views/system/about/index.vue"),
      },
    ],
  },
  /* 匹配任意的路由 必须最后注册 */
  {
    path: "/:pathMatch(.*)",
    name: "Any",
    redirect: "/404",
    meta: {
      hidden: true,
    },
  },
]

/**
 * 定义动态路由
 */
export const allAsyncRoutes: Array<RouteRecordRaw> = []
